/*
 * @(#)HobackPlayStatus.java $version 2013. 5. 14.
 *
 * Copyright 2012 NHN Corp. All rights Reserved. 
 * NHN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
 */

package com.pace.gonu.model.status;

import java.util.ArrayList;
import java.util.List;

import com.pace.gonu.constants.HobakBoardXY;
import com.pace.gonu.constants.Order;
import com.pace.gonu.constants.Status;
import com.pace.gonu.model.BoardPath;
import com.pace.gonu.model.PlayRock;

/**
 * @author pace
 */
public class HobakPlayStatus implements PlayStatus {
	private List<PlayRock> playRocks = new ArrayList<PlayRock>();
	private Order order = Order.BLACK;
	private final int MAX_ROCKS = 8;
	private Status statusType = Status.NORMAL;

	public HobakPlayStatus() {
		PlayRock playRock1 = new PlayRock();
		BoardPath path1 = new BoardPath();
		path1.setX(HobakBoardXY.r1.getX());
		path1.setY(HobakBoardXY.r1.getY());
		setRocks(playRock1, path1, Order.BLACK, 1);

		PlayRock playRock2 = new PlayRock();
		BoardPath path2 = new BoardPath();
		path2.setX(HobakBoardXY.r2.getX());
		path2.setY(HobakBoardXY.r2.getY());
		setRocks(playRock2, path2, Order.BLACK, 2);

		PlayRock playRock3 = new PlayRock();
		BoardPath path3 = new BoardPath();
		path3.setX(HobakBoardXY.r3.getX());
		path3.setY(HobakBoardXY.r3.getY());
		setRocks(playRock3, path3, Order.BLACK, 3);

		PlayRock playRock4 = new PlayRock();
		BoardPath path4 = new BoardPath();
		path4.setX(HobakBoardXY.r4.getX());
		path4.setY(HobakBoardXY.r4.getY());
		setRocks(playRock4, path4, Order.BLACK, 0);

		PlayRock playRock5 = new PlayRock();
		BoardPath path5 = new BoardPath();
		path5.setX(HobakBoardXY.r8.getX());
		path5.setY(HobakBoardXY.r8.getY());
		setRocks(playRock5, path5, Order.WHITE, 0);

		PlayRock playRock6 = new PlayRock();
		BoardPath path6 = new BoardPath();
		path6.setX(HobakBoardXY.r9.getX());
		path6.setY(HobakBoardXY.r9.getY());
		setRocks(playRock6, path6, Order.WHITE, 9);

		PlayRock playRock7 = new PlayRock();
		BoardPath path7 = new BoardPath();
		path7.setX(HobakBoardXY.r10.getX());
		path7.setY(HobakBoardXY.r10.getY());
		setRocks(playRock7, path7, Order.WHITE, 10);

		PlayRock playRock8 = new PlayRock();
		BoardPath path8 = new BoardPath();
		path8.setX(HobakBoardXY.r11.getX());
		path8.setY(HobakBoardXY.r11.getY());
		setRocks(playRock8, path8, Order.WHITE, 11);

	}

	private void setRocks(PlayRock playRock, BoardPath path, Order order, int initPathIndex) {
		playRock.setPath(path);
		playRock.setOrder(order);
		playRock.setInitPathIndex(initPathIndex);
		playRocks.add(playRock);
	}

	@Override
	public List<PlayRock> getPlayRocks() {
		return playRocks;
	}

	@Override
	public String getOrder() {
		return order.toString();
	}

	@Override
	public void setOrder(Order order) {
		this.order = order;
	}

	public int getMAX_ROCKS() {
		return MAX_ROCKS;
	}

	@Override
	public List<PlayRock> getMoveRocks() {
		return null;
	}

	@Override
	public String getStatusType() {
		return statusType.toString();
	}

	@Override
	public void setStatusType(Status status) {
		statusType = status;
	}

	@Override
	public List<PlayRock> getXRocks() {
		return null;
	}
}
